package com.analysis.service;

import com.analysis.entity.CompanyVersionRef;
import com.analysis.mapper.CompanyVersionRefMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class CompanyVersionRefService {

    @Autowired
    private CompanyVersionRefMapper companyVersionRefMapper;

    public int create(CompanyVersionRef ref) {
        return companyVersionRefMapper.insert(ref);
    }

    public int delete(Long id) {
        return companyVersionRefMapper.deleteById(id);
    }

    public int update(CompanyVersionRef ref) {
        return companyVersionRefMapper.update(ref);
    }

    public CompanyVersionRef getById(Long id) {
        return companyVersionRefMapper.selectById(id);
    }

    public List<CompanyVersionRef> listByCompany(Long companyId) {
        return companyVersionRefMapper.selectByCompanyId(companyId);
    }

    public List<CompanyVersionRef> listByVersion(Long versionId) {
        return companyVersionRefMapper.selectByVersionId(versionId);
    }

    public CompanyVersionRef getByCompanyAndVersion(Long companyId, Long versionId) {
        return companyVersionRefMapper.selectByCompanyAndVersion(companyId, versionId);
    }
}


